@extends('backend.layouts.main')
@section('content')
    <section class="content-header">
        <h1>
            购买记录
            <small>购买记录</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{URL('admin/index')}}"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active"><a href="{{URL('admin/student')}}">学员列表</a></li>
        </ol>

    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <!-- /.box-header -->
                    <div class="box-body  table-responsive">
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th>课程分类</th>
                                <th>课程名称</th>
                                <th>教练姓名</th>
                                <th>购买金额</th>
                                <th>购买次数</th>
                                <th>已预约次数</th>
                                <th>剩余次数</th>
                                <th>会员开始时间</th>
                                <th>会员结束时间</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            @if(!empty($studentBuyDatas[0]->id))
                                @foreach($studentBuyDatas AS $key=>$studentData)
                                    <tr style="color:#888;font-weight:normal">
                                        <td>
                                            @if($studentData->stu_status==0)
                                                团课
                                            @else
                                                私教课
                                            @endif
                                        </td>

                                        <td>
                                            @if($studentData->stu_status==0)
                                                {{DANCE[$studentData->teacher_id]}}
                                            @endif
                                        </td>
                                        <td>
                                            @if($studentData->stu_status==1)
                                                {{$studentData->getUser?$studentData->getUser->name:""}}
                                            @endif
                                            @if($studentData->stu_status==0)
                                                {{$studentData->getUserBelongsTo?$studentData->getUserBelongsTo->getUserBelongsTo->name:""}}
                                            @endif
                                        </td>
                                        <td style="cursor:pointer">
                                            {{$studentData->amount??'0.00'}}
                                        </td>
                                        <td style="cursor:pointer">
                                            {{$studentData->member_number??0}}
                                        </td>
                                        <td style="cursor:pointer">
                                            {{$studentData->surplus_number??0}}
                                        </td>

                                        <td style="cursor:pointer">
                                            @if($studentData->member_number-$studentData->surplus_number>=0)
                                                {{$studentData->member_number-$studentData->surplus_number}}
                                            @else
                                                0
                                            @endif
                                        </td>
                                        <td>{{$studentData->begin_time?date("Y-m-d H:i:s",$studentData->begin_time):" "}}</td>
                                        <td>{{$studentData->end_time?date("Y-m-d H:i:s",$studentData->end_time):" "}}</td>
                                        <td>{{$studentData->created_at?date("Y-m-d H:i:s",$studentData->created_at):""}}</td>
                                        <td>
                                            <a type="button"
                                               onclick="delConfirm('/admin/student/buyLogDelete/{{encryptionUrl($studentData->id)}}', '{{encryptionUrl($studentData->student_id)}}')"
                                               class="btn btn-danger btn-sm"><i class="fa fa-close"></i>删除</a>
                                        </td>
                                    </tr>
                                @endforeach
                            @else
                                <tr style="color:#888;font-weight:normal">
                                    <td colspan="8" align="center">暂无数据</td>
                                </tr>
                            @endif
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </section>
@endsection
